$("#main").on("input", ".search-inp", function () {
        var val = $(this).val();
        if (val) {
            $(".search-img").css("display", "block");
            $(".search-txt_cancel").css("display", "none")
            $(".search-txt_s").css("display", "block")
        } else {
            $(".search-img").css("display", "none");
            $(".search-txt_s").css("display", "none")
            $(".search-txt_cancel").css("display", "block")
        }
    })
    if ($(".search-inp").val()) {
        $(".search-img").css("display", "block");
        $(".search-txt_cancel").css("display", "none")
        $(".search-txt_s").css("display", "block")
    }

//将搜索记录加入缓存
//清除缓存事件
//跳转事件
//var  keywordArr=storage.getItem('keyword');
    var keywordArr = JSON.parse(storage.getItem('keyword'));
    if (keywordArr == null) {
        keywordArr = {
            'keywordArr': []
        }
    }
    console.log(keywordArr);
    var strrrr = ''
    for (var i = 0; i < keywordArr.keywordArr.length; i++) {
        strrrr += '<span>' + keywordArr.keywordArr[i] + '</span>'
    }
    $(".history-main").html(strrrr)
    $(".search_r").on('click', function () {
        var keyword = $(".search-inp").val();
        var arrNum = $.inArray(keyword, keywordArr['keywordArr'])
        if (arrNum > -1) {
            keywordArr['keywordArr'].splice(arrNum, 1);
        }
        keywordArr['keywordArr'].unshift(keyword);
        var data = JSON.stringify(keywordArr);
        console.log(data)
        storage.setItem('keyword', data);
        location.href = 'search_result.html?keyword=' + keyword;
    });
    $(".eliminate").on('click', function () {
        storage.removeItem('keyword');
        $(this).parent().next().html("")
    });
    $(".history-main").on("click","span",function () {
        var keywordText=$(this).text();
        location.href = 'search_result.html?keyword=' + keywordText;
    })
